﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;

namespace SistemaAcademicoDAL
{
    public class IdentCurrentDAO : AbstratcDAO
    {
        public IdentCurrentDAO()
        {
            connection = new Connection();
        }

        public int getIdentCurrent(string tbName)
        {
            connection.ConnectionString = ConfigurationManager.ConnectionStrings["CONN"].ConnectionString;

            SqlConnection cn = new SqlConnection(connection.ConnectionString);
            cn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cn;
            cmd.CommandText = @"select ident_current('" + tbName + "')";
            int identCurrent = Convert.ToInt32(cmd.ExecuteScalar());
            cn.Close();
            return identCurrent;
        }
    }
}
